package com.ben.xinyue.seckill.controller;

import com.ben.xinyue.seckill.domain.entity.User;
import com.ben.xinyue.seckill.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName: SimpleController
 * @Description: 测试用Controller
 * @author: xinyue
 * @date: 2020/9/1 8:30 下午
 * @version: 1.0.0
 */
@Controller
@RequestMapping("simple")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SimpleController {

    private final UserService userService;

    @RequestMapping("thymeleaf")
    public String thymeleaf(Model model){
        model.addAttribute("name","abc");
        return "hello";
    }

    @RequestMapping("search")
    @ResponseBody
    public User user(){
        return userService.search();
    }
}
